package exam.bak.netease;

import java.util.Scanner;

public class P1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int num = n, result = 0, d = 0;
        while (num > 0) {
            d = num % 10;
            num = num / 10;
            if (d != 0 && n % d == 0) {
                result++;
            }
        }
        System.out.println(result);
    }
}
